define(["jquery", "bootstrap", "backend", "table", "form"], function ($, undefined, Backend, Table, Form) {
  var Controller = {
    index: function () {
      // 初始化表格参数配置
      Table.api.init({
        extend: {
          index_url: "fssy/nsqtrt6jt/index" + location.search,
          add_url: "fssy/nsqtrt6jt/add",
          edit_url: "fssy/nsqtrt6jt/edit",
          del_url: "fssy/nsqtrt6jt/del",
          multi_url: "fssy/nsqtrt6jt/multi",
          import_url: "fssy/nsqtrt6jt/import",
          table: "fssy_nsqtrt6jt",
        },
      });

      var table = $("#table");

      // 初始化表格
      table.bootstrapTable({
        url: $.fn.bootstrapTable.defaults.extend.index_url,
        pk: "id",
        sortName: "id",
        columns: [
          [
            { checkbox: true },
            { field: "id", title: __("Id") },
            {
              field: "time_querter",
              title: __("Time"),
              sortable: true,
            },
            { field: "zc01rs", title: __("Zc01rs") },
            { field: "zc02rs", title: __("Zc02rs") },
            { field: "zc03rs", title: __("Zc03rs") },
            { field: "zc04rs", title: __("Zc04rs") },
            { field: "zc05rs", title: __("Zc05rs") },
            {
              field: "createtime",
              title: __("Createtime"),
              operate: "RANGE",
              addclass: "datetimerange",
              autocomplete: false,
              formatter: Table.api.formatter.datetime,
            },
            {
              field: "updatetime",
              title: __("Updatetime"),
              operate: "RANGE",
              addclass: "datetimerange",
              autocomplete: false,
              formatter: Table.api.formatter.datetime,
            },
          ],
        ],
      });

      // 为表格绑定事件
      Table.api.bindevent(table);
    },
    add: function () {
      Controller.api.bindevent();
    },
    edit: function () {
      Controller.api.bindevent();
    },
    api: {
      bindevent: function () {
        Form.api.bindevent($("form[role=form]"));
      },
    },
  };
  return Controller;
});
